﻿#region Copyright 
/*-------------------------------------------------------------------------
* 命名空间名称/文件名:    SSPivot.AspNetCore.Abstractions.User/ICurrentUser 
* CLR版本:     4.0.30319.42000
* 机器名称:    DESKTOP-NHMLO8A
* 功 能：       N/A
* 类 名：       ICurrentUser
* 创建时间：  2025/5/22 15:36:09
* 版本号：      v1.0
* 创建人:        xulong
*-------------------------------------------------------------------------*/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;

namespace SSPivot.AspNetCore.Abstractions.User
{
    public interface ICurrentUser
    {
        bool IsAuthenticated { get; }
        /// <summary>
        /// 用户Id
        /// </summary>
        long? Id { get; }
        /// <summary>
        /// 用户名
        /// </summary>
        string Account { get; }
        /// <summary>
        /// 姓名
        /// </summary>
        string Name { get; }
        /// <summary>
        /// 用户类型
        /// </summary>
        UserType Type { get; }
        /// <summary>
        /// 默认用户
        /// </summary>
        bool DefaultUser { get; }
        /// <summary>
        /// 平台管理员
        /// </summary>
        bool PlatformAdmin { get; }
        /// <summary>
        /// 租户管理员
        /// </summary>
        bool TenantAdmin { get; }
        /// <summary>
        /// 租户Id
        /// </summary>
        long? TenantId { get; }

        string Platform { get; }
        string SurName { get; }
        string Source { get; }
        string PhoneNumber { get; }

        bool PhoneNumberVerified { get; }

        string Email { get; }

        bool EmailVerified { get; }

        string? TenantName { get; }

        string[] Roles { get; }

        string RoleScope { get; }

        Claim FindClaim(string claimType);

        Claim[] FindClaims(string claimType);

        Claim[] GetAllClaims();

        bool IsInRole(string roleName);
        /// <summary>
        /// 数据权限
        /// </summary>
        DataPermissionDto DataPermission { get; }

        /// <summary>
        /// 用户权限
        /// </summary>
        UserPermissionDto UserPermission { get; }

        /// <summary>
        /// 检查用户是否拥有某个权限点
        /// </summary>
        /// <param name="permissionCode">权限点编码</param>
        /// <returns></returns>
        bool HasPermission(string permissionCode);

        /// <summary>
        /// 检查用户是否拥有这些权限点
        /// </summary>
        /// <param name="permissionCodes">权限点编码列表</param>
        /// <param name="all">是否全部满足</param>
        /// <returns></returns>
        bool HasPermissions(string[] permissionCodes, bool all = false);
    }
}
